# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=libraqm
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.1.1
pkgrel=1
pkgdesc="A library that encapsulates the logic for complex text layout (mingw-w64)"
arch=('any')
url="https://github.com/HOST-Oman/libraqm"
depends=("${MINGW_PACKAGE_PREFIX}-freetype"
         "${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-harfbuzz" 
         "${MINGW_PACKAGE_PREFIX}-fribidi")
makedepends=("gtk-doc")
license=('custom')
source=("${_realname}-$pkgver".tar.gz::"https://github.com/HOST-Oman/libraqm/archive/v${pkgver}.tar.gz")
sha256sums=('d3a53bb6d10215a244d89e1c818d43e11b6ceca7b8cc8a580cca8b36fa537011')

prepare() {
  cd $srcdir/${_realname}-${pkgver}
  ./autogen.sh
}

build() {
  cd "$srcdir"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && \
    cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static=yes \
    --enable-shared=yes \
    --enable-fast-install=yes \
    --enable-gtk-doc=no
  make
}

#tests require chcp 65001

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
  install -D -m644  "$srcdir/${_realname}-${pkgver}/COPYING" \
           "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
